<template>
  <div id="app">
      <keep-alive>
        <router-view v-if="isRouterAlive"></router-view>
      </keep-alive>
  </div>
</template>

<script>
export default {
  name: 'App',
  components: {
  },
  provide () {
    return {
      reload: this.reload
    }
  },
  data () {
    return {
      isRouterAlive: true
    }
  },
  watch: {
    '$route' () {
      const locationHash = window.location.href;
      sessionStorage.setItem("hashLocation", locationHash);// 把路由存在缓存中，此处你可以console.log看出路由变化
    }
  },
  methods: {
    reload () {
      this.isRouterAlive = false
      this.$nextTick(function () {
        this.isRouterAlive = true
      })
    }
  }
}

</script>

<style scoped>
  @import "common/css/normalize.css";
</style>
